package common;

import com.google.gson.Gson;

/**
 * Created by Ken on 2020/5/6.
 */
public class AjaxResult {
    private Boolean success;
    private String message;
    private Object data;
    private String statusCode;
    private Long total;
    private String server;

    public AjaxResult() {
        super();
    }

    /**
     * 数据
     * @param data
     */
    public AjaxResult(Object data) {
        this.success = true;
        this.message = "";
        this.data = data;
        this.statusCode = "";
    }

    /**
     *
     * @param success 是否成功
     * @param message 消息
     * @param data 数据
     * @param statusCode 状态码
     */
    public AjaxResult(Boolean success, String message, Object data, String statusCode) {
        this.success = success;
        this.message = message;
        this.data = data;
        this.statusCode = statusCode;
    }

    public Boolean getSuccess() {
        return success;
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public AjaxResult setMessage(String message) {

        this.message = message;
        return this;
    }

    public Object getData() {
        return data;
    }

    public AjaxResult setData(Object data) {
        this.data = data;
        return  this;
    }

    public String getStatusCode() {
        return statusCode;
    }

    public AjaxResult setStatusCode(String statusCode) {
        this.statusCode = statusCode;
        return this;
    }

    public String toString(){
        return  new Gson().toJson(this).toString();
    }

    public Long getTotal() {
        return total;
    }

    public AjaxResult setTotal(Long total) {
        this.total = total;
        return this;
    }

    public String getServer() {
        return server;
    }

    public AjaxResult setServer(String server) {
        this.server = server;
        return this;
    }


}
